<template>
<transition name="fade">
  <div class="box">
    <header class="coupon-header">
      <router-link tag="span" :class="item.icon" :to="item.path" v-for="(item, index) of list" :key="index"></router-link>
      <span>优惠券</span>
    </header>
    <div class="coupon-content">
      <ul class="coupon-content-ul">
        <li v-for="(coupon, couponindex) of couponlist" :key="couponindex">
          <!-- <p>{{coupon.pname}}</p> -->
          <div class="coupon-content-ul-pro">
            <img :src="coupon.pimg" alt="">
          </div>
        </li>
      </ul>
    </div>
  </div>
</transition>
</template>

<script>
import Vue from 'vue'
import axios from 'axios'
import Qs from 'qs'
import { Swipe, SwipeItem, Lazyload } from 'mint-ui'
Vue.use(Swipe, SwipeItem, Lazyload)
export default {
  data () {
    return {
      list: [
        {
          path: '/mine',
          icon: 'iconfont icon-fanhui2'
        }
      ],
      couponlist: [
        {
          pimg: '//gju1.alicdn.com/tps/i3/6000000002420/O1CN01lsKH5p1TkOxlJFCPR_!!6000000002420-0-jupush.jpg_760x760Q90.jpg_.webp',
          pname: '优惠的价格',
          pdesc: '锻炼小手灵活度',
          pprice: '29.9'
        },
        {
          pimg: '//gju3.alicdn.com/tps/i3/6000000007993/O1CN01PH4XIO28uqEnQxkLn_!!6000000007993-0-jupush.jpg_760x760Q90.jpg_.webp',
          pname: '优惠的价格',
          pdesc: '锻炼小手灵活度',
          pprice: '29.9'
        },
        {
          pimg: '//gju1.alicdn.com/tps/i2/6000000008019/O1CN01z1IyxI296kXKW1hOL_!!6000000008019-0-jupush.jpg_760x760Q90.jpg_.webp',
          pname: '优惠的价格',
          pdesc: '锻炼小手灵活度',
          pprice: '29.9'
        },
        {
          pimg: '//gju4.alicdn.com/tps/i3/6000000007132/O1CN01UpJ8iM22YVE3G2Hm4_!!6000000007132-0-jupush.jpg_760x760Q90.jpg_.webp',
          pname: '优惠的价格',
          pdesc: '锻炼小手灵活度',
          pprice: '29.9'
        },
        {
          pimg: '//gju1.alicdn.com/tps/i3/6000000002843/O1CN01oRjF4i1Ws8V3xWmLK_!!6000000002843-0-jupush.jpg_760x760Q90.jpg_.webp',
          pname: '优惠的价格',
          pdesc: '锻炼小手灵活度',
          pprice: '29.9'
        },
        {
          pimg: '//gju2.alicdn.com/tps/i4/6000000004699/O1CN01zHcGd61kaBb7mq5cI_!!6000000004699-0-jupush.jpg_760x760Q90.jpg_.webp',
          pname: '优惠的价格',
          pdesc: '锻炼小手灵活度',
          pprice: '29.9'
        },
        {
          pimg: '//gju4.alicdn.com/tps/i3/6000000007271/O1CN016Z7xe023aAHL0QRQW_!!6000000007271-0-jupush.jpg_760x760Q90.jpg_.webp',
          pname: '优惠的价格',
          pdesc: '锻炼小手灵活度',
          pprice: '29.9'
        },
        {
          pimg: '//gju4.alicdn.com/tps/i4/6000000005263/O1CN01ZMhyhN1okUykWYfUX_!!6000000005263-0-jupush.jpg_760x760Q90.jpg_.webp',
          pname: '优惠的价格',
          pdesc: '锻炼小手灵活度',
          pprice: '29.9'
        }
      ]
    }
  },
  created () {
    let data = {
      token: '7qwN83Y2xI2xasQikfLHvwFwLQKxxk5wZyi6Ej+So2Vx1864is3FP2c+zr18HzNAC7fzHZHbmLDWwJraATqJ+cjyp9aSekyCKPoiVit0kHqEJYNu3/HhVAqSW1YJBo9GtG4aH2RSdJ194HC4Slo8wLMBKgvd61ZSGeyJJ80HEnPtUff6/csmpBFsSlXoVRN+DygYwJsRRi2im1HkL0zDJr9GL1nJSxfJLr2+3dEGuEGyDJYuS6aGVaSzY7BCGX2OBspUNJw5BuYR/t3hvUWPCYbfCSehfNHALihJVTJ39LLJ9d/uyc4ciyBA5ZbusTst'
    }
    axios({
      method: 'post',
      url: 'http://10.8.162.12:8081/minecollection.do',
      data: Qs.stringify(data)
    })
      .then((res) => {
        console.log(res)
      })
      .catch(function (error) {
        console.log(error)
      })
  }
}
</script>

<style lang="scss">
// 头部
.coupon-header{
  width:3.75rem;
  height:0.42rem;
  line-height:0.42rem;
  background:rgb(235, 235, 235);
  text-align: center;
  span{
    &:nth-child(1){
     font-size:0.16rem;
     float:left;
     font-weight: 700;
     margin-left:0.15rem;
    };
    &:nth-child(2){
      display:block;
      font-size:0.14rem;
      float:left;
       margin-left:1.3rem;
    }
  }
}
// 优惠券展示部分
.coupon-content{
  overflow-y:scroll;
  flex:1;
  .coupon-content-ul{
      width:3.75rem;
      flex:1;
      background:0;
      display: flex;
      flex-wrap: wrap;
      li{
        width:3.75rem;
        height:1rem;
        margin-top:0.3rem;
        display:flex;
        justify-content: space-between;
      .coupon-content-ul-pro{
           width:100%;
           height:100%;
           background:rgb(155, 38, 25);
        img{
               display: block;
               width:100%;
               height:100%;
        }
          }
        // p:nth-of-type(1){
        //         width:20%;
        //         height:100%;
        //         line-height:100%;
        //         font-size:0.12rem;
        //         background:#ccc;
        // }
       }
    }
}

</style>
